# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=rsync
pkgver=3.1.1
pkgrel=1
pkgdesc="A file transfer program to keep remote files in sync"
arch=('i686' 'x86_64')
url="http://samba.anu.edu.au/rsync/"
groups=('net-utils')
license=('GPL3')
depends=('perl')
source=("http://rsync.samba.org/ftp/rsync/$pkgname-$pkgver.tar.gz"
        "http://rsync.samba.org/ftp/rsync/$pkgname-$pkgver.tar.gz.asc"
        rsync-3.1.0-msys2.patch
        ssh-6-option.patch)
md5sums=('43bd6676f0b404326eee2d63be3cdcfe'
         'SKIP'
         '6964f315300b3cfe8f663d1386628368'
         '2d66b179a84cafbec06968260cb85df4')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  patch -p1 -i ${srcdir}/rsync-3.1.0-msys2.patch
  patch -p1 -i ${srcdir}/ssh-6-option.patch

  autoreconf -fi
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  ./configure --build=${CHOST} \
    --prefix=/usr \
    --without-included-zlib
  make man all
}

check() {
  cd "$srcdir/$pkgname-$pkgver"
  make test
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  install -Dm755 support/rrsync "$pkgdir/usr/lib/rsync/rrsync"
}
